added process method to conversion class
authorØyvind Kolås <ok@src.gnome.org>
Tue, 23 Aug 2005 07:50:02 +0000 (07:50 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Tue, 23 Aug 2005 07:50:02 +0000 (07:50 +0000)
ChangeLog
babl/babl-conversion.c
babl/babl-conversion.h
babl/babl-instance.h

index 18743efeaa2fbd1e5557ffc10a8370c9f7c2444e..c85c614977ae7bf0e801cd3f8f1a3da0c8765b4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-23  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl-instance.h: babl_class_name is moved to babl-classes.h
+       * babl/babl-conversion.h: add a method to the conversion class for the
+       processing with registered functions.
+       * babl/babl-fish.c: Use above functions.
+
 2005-08-23  Øyvind Kolås  <pippin@gimp.org>
 
        * babl/babl-memory.[ch]: added additonal sanity checking (only
@@ -24,7 +31,6 @@
 2005-08-22  Øyvind Kolås  <pippin@gimp.org>
 
        * babl/babl-classes.h: (BabPixelFormat): only a single BablModel.
-       * babl/babl-fish.h,
        * babl/babl-pixel-format.h,
        * tests/babl-html-dump.c: accomodate change.
 
index 2388b11318be7142726b831966c7d0074490a200..7b6f668ff96007b0e803a5ead75c5704605ca95a 100644 (file)
@@ -233,4 +233,63 @@ babl_conversion_new (const char *name,
     }
 }
 
+static void
+babl_conversion_linear_process (BablConversion *conversion,
+                                void           *source,
+                                void           *destination,
+                                long            n)
+{
+  conversion->function.linear (source, destination, n);
+}
+
+static void
+babl_conversion_planar_process (BablConversion *conversion,
+                                BablImage      *source,
+                                BablImage      *destination,
+                                long            n)
+{
+  conversion->function.planar (source->bands,
+                               source->data,
+                               source->pitch,
+                               destination->bands,
+                               destination->data,
+                               destination->pitch,
+                               n);
+}
+
+/* this is the place to insert usage instrumentation into babl */
+void
+babl_conversion_process (BablConversion *conversion,
+                         void           *source,
+                         void           *destination,
+                         long            n)
+{
+  assert (BABL_IS_BABL (conversion));
+
+  switch (BABL(conversion)->class_type)
+  {
+    case BABL_CONVERSION_TYPE:
+      babl_conversion_linear_process (conversion,
+                                      source,
+                                      destination,
+                                      n);
+      break;
+    case BABL_CONVERSION_MODEL_PLANAR:
+      assert (BABL_IS_BABL (source));
+      assert (BABL_IS_BABL (destination));
+
+      babl_conversion_planar_process (                  conversion,
+                                      (BablImage*)      source, 
+                                      (BablImage*)      destination,
+                                                        n);
+      break;
+    default:
+      babl_log ("%s(%s, %p, %p, %li) unhandled conversion type: %s",
+          __FUNCTION__, conversion->instance.name, source, destination, n,
+          babl_class_name (conversion->instance.class_type));
+      break;
+  }
+          
+}
+
 BABL_CLASS_TEMPLATE (babl_conversion)
index 327de7554ba4054819252d5531ab79450df4fc21..286d6a2a0c85e8810b5aaccef71d4748db99a5c2 100644 (file)
@@ -24,4 +24,9 @@
 
 BABL_DEFINE_CLASS (babl_conversion)
 
+void babl_conversion_process (BablConversion *conversion,
+                              void           *source,
+                              void           *destination,
+                              long           n);
+
 #endif
index cfd7ff262e38268e2b51e951f664d1872c646806..17f246e103ba8ebfd9f61c3efbed4c7fa169649d 100644 (file)
@@ -5,7 +5,6 @@
 typedef int  (*BablEachFunction) (Babl *entry,
                                   void *data);
 
-const char  *babl_class_name     (BablClassType klass);
 
 /* these defines are kept here to keep the typing needed in class
  * headers to a minimum, only the ones overriding the basic api with